local Class = require('lua.lang.Class')
local LuaValue = require('lua.vm.LuaValue')

--- @class LuaBoolean : LuaValue
--- @field v boolean
local LuaBoolean = Class {
	__extends = LuaValue
}

--- @constructor
--- @param v boolean
--- @return LuaBoolean
function LuaBoolean:new(v)
	local o = {
		v = v
	}
	return setmetatable(o, LuaBoolean)
end

LuaBoolean._TRUE = LuaBoolean:new(true)
LuaBoolean._FALSE = LuaBoolean:new(false)

--- @return boolean
function LuaBoolean:isBoolean()
	return true
end

--- @return number
function LuaBoolean:type()
	return self.TYPE_BOOLEAN
end

--- @return string
function LuaBoolean:typeName()
	return self.TYPE_NAMES[self:type() + 1]
end

--- @return boolean
function LuaBoolean:toBoolean()
	return self.v
end

return LuaBoolean